package com.job.Gai_Yian.Homework0715;

/**
 * @author Gai_Yian
 * @version 1.0
 * @since 2022-07-15 14:31:19
 */
public class StringDemo01 {
    public static void main(String[] args) {
        //使用字面值初始化字符串常量方法
        String s1="ABC";
        String s2="ABC";
        System.out.println(s1==s2);
        //使用构造方法初始化字符串
        String s3=new String("ABC");
        String s4=new String("ABC");
        System.out.println(s3==s4);
        System.out.println(s3==s1);
        System.out.println(s4==s1);
        //用equals方法就全是true

        s1+="D";
        System.out.println(s1);
    }
}
